//
//  DiscountableViewCell.m
//  AroundTheWorld
//
//  Created by dllo on 16/5/17.
//  Copyright © 2016年 IfelseGo an. All rights reserved.
//

#import "DiscountableViewCell.h"

#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height

@implementation DiscountableViewCell

//自定义初始化
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addView];
        
    }
    return self;
}

- (void)addView
{
    self.myBgImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.myBgImageView];
    self.myBgImageButton = [self addButton];
    self.myBgImageButton.backgroundColor = [UIColor clearColor];
    
    self.myTextButton = [self addButton];
    [self.myTextButton setTitle:@"查看全部特价折扣 >" forState:UIControlStateNormal];
    [self.myTextButton setTitleColor:[UIColor colorWithRed:69 / 255.0 green:181 / 255.0 blue:134 / 255.0 alpha:1.0] forState:UIControlStateNormal];
    
    self.FGXLabel = [[UILabel alloc] init];
    self.FGXLabel.backgroundColor = [UIColor colorWithRed:232 / 255.0 green:230 / 255.0 blue:233 / 255.0 alpha:1];
    [self.contentView addSubview:self.FGXLabel];
    
}

//addButton
- (UIButton *)addButton
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    //    button.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:button];
    return button;
}
//分布
- (void)layoutSubviews
{
    [super layoutSubviews];
    //    self.myBgImageButton.frame = CGRectMake(7 / 414 * WIDTH, 7 / 414 * WIDTH, WIDTH - 14, (WIDTH - 14) * 175 / 414);
    self.myBgImageButton.frame = CGRectMake(7, 0, 400, 165);
    self.myBgImageView.frame = CGRectMake(7, 0, 400, 165);

    
    self.myTextButton.frame = CGRectMake(7, 572, WIDTH - 14, 53);
    self.FGXLabel.frame = CGRectMake(0, 570, WIDTH, 2);
}

- (void)setDiscontArrayM:(NSMutableArray *)discontArrayM
{
    _discontArrayM = discontArrayM;
    
    
    
}

- (void)setMyDisSubModel:(Discount_SubjectModel *)myDisSubModel{
    _myDisSubModel = myDisSubModel;
    [self.myBgImageView sd_setImageWithURL:[NSURL URLWithString:_myDisSubModel.photo] placeholderImage:[UIImage imageNamed:@""]];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
